from wordcloud import WordCloud
from PIL import Image
import numpy
import jieba
with open("./c.txt", encoding='utf-8') as f:
    text = f.read()
text = jieba.cut(text)
text = " ".join(text)
mask =Image.open('./alice.png')
mask = numpy.array(mask)
stop_words = ["没有", '的', '我', '你']
w = WordCloud(font_path="./font1.ttf", stopwords=stop_words, mask=mask, max_words=200, background_color="white", contour_width=3, contour_color='orange').generate(text)

w.to_file('./c.jpg')

